	<table width="100%">
	<?php forEach($CUSTOMREFERENCE['itemSectionList'] as $record){ ?>

		<tr>
				<td valign="top" width="40%">
					<form id="form_{page}_<?=$record['id']; ?>" >
					<table>
						<tr>
							<td width="150px"><?=$record['name']; ?></td>
							<td>
								<input type="hidden" name="item_id" value="<?=$query_value?>">
								<input type="hidden" name="item_section_id" value="<?=$record['id']?>">
								<input type="text" name="name"><font color="red" style="font-size: 20">*</font>
								<select name="item_color_id" id="select_available_color_<?=$record['id']?>" style="width:200px">
								<?php 
								forEach($CUSTOMREFERENCE['availableColors'] as $color)
									echo "<option value='".$color['id']."'>".$color['name']."</option>";
								?>
							    </select>
							  </td>
						</tr>
						<tr>
							<td colspan="2">
								<font color ="red" id="error_message_{page}_<?=$record['id']?>">
							</td>
						</tr>
					</table>
					</form>
				</td>
				<td valign="top" width="8%" align="left">
					<a href="javascript:void(0)" id="link_{page}_<?=$record['id']?>">[Add >>]</a>
				</td>
				<td valign="top">
					<?php // $section_colors = "item_section_color_section_".$record['id'] ?>
					<?php // $section_colors_list = $CUSTOMREFERENCE[$section_colors]; ?>
					
					
					<div id="div_list_of_{page}_<?=$record['id']?>">
					<!-- 
						<table>
							<tr>
								<td>
									
								</td>
								</tr>
								
						<?php 
							//$size = count($section_colors_list);
							//if($size != 0): 
							//	forEach($section_colors_list as $section_color){ ?>
								<tr>
								<td>
									<?//=//$section_color['id'].":::::::::::::::::::::". $section_color['name']?>
								</td>
								</tr>
							<?php 
							//}
						//endif;?>
						
						</table>
						 -->
					</div>
				</td>
				
		</tr>
		
	<?php } ?>
	</table>

<form id="yohantenma">
	
	<input type="submit">
</form>
<div id="testyohantenmadiv">

</div>

<script type="text/javascript">
	$(document).ready(function(){
	//	addAjaxSubmitListener("yohantenma" , "testyohantenmadiv" ,"{URL}/item_section_color/listall_a" , "loadlistuponsuccess" );

		<?php
			forEach($CUSTOMREFERENCE['itemSectionList'] as $record){ ?>
				addAjaxClickSubmitListener('<?=$record['id']?>' , "link_{page}_"+<?=$record['id']?> , "form_{page}_" +<?=$record['id']?> , "div_list_of_{page}_"+<?=$record['id']?> ,"{URL}/item_section_color/ajaxinsert", "loadlistuponsuccess" );
				loadlistuponsuccess('<?=$record['id']?>' ,null  , "div_list_of_{page}_"+<?=$record['id']?> , "{URL}/item_section_color/byfield_a/item_section_id/"+<?=$record['id']?>, "loadlistuponsuccess")
			<?php }?>


	});

	function loadlistuponsuccess(id , formId , resultDiv , destinationUrl){
		//function loadpage(divId , url , destinationUrl){
		//loadpage(divId , url , destinationUrl)
		
		console.log(destinationUrl);
		loadpage(resultDiv , "{URL}/item_section_color/byfield_a/item_section_id/"+id);
		//alert("CALLED");
	}
</script>